But how to avoid confirmation bias?
The best way to avoid confirmation bias is to release oneself from caring about the outcome (a conclusion) of an argument and, instead, focus on looking for objectively verified information (for purpose of this subject we'll call this: facts). Once you have verifiable information at your disposal then you can use this/these as premises to form logical arguments, which will lead to conclusions without bias.
Let objectively verified information and valid argument forms decide the conclusions.
Confirmation bias disappears because you don't care about the conclusion. If, as it turns out, human behavior is the subject of research what I've said does not suggest a person must be amoral. Rather it means a person must be willing to let their morality be guided by facts rather than preference.